Skip to content

Conversation

@asmaastarkware
Copy link
Contributor

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

@asmaastarkware asmaastarkware marked this pull request as ready for review January 11, 2026 08:50
@asmaastarkware asmaastarkware changed the title apollo_protobuf: merge init with block info apollo_protobuf: merge ProposalInit into ConsensusBlockInfo Jan 11, 2026
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from 64d050f to c7d10e7 Compare January 11, 2026 08:53
@asmaastarkware asmaastarkware force-pushed the asmaa/move_executed_transaction_count_into_proposalfin branch from 995d0e1 to a30b99a Compare January 11, 2026 12:25
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from c7d10e7 to e9a0f0a Compare January 11, 2026 12:25
@asmaastarkware asmaastarkware force-pushed the asmaa/move_executed_transaction_count_into_proposalfin branch from a30b99a to 4ec78c9 Compare January 12, 2026 12:11
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch 2 times, most recently from 32c8ef9 to c43012f Compare January 12, 2026 13:54
@asmaastarkware asmaastarkware force-pushed the asmaa/move_executed_transaction_count_into_proposalfin branch 2 times, most recently from aea9a2a to 47fb0cf Compare January 12, 2026 14:43
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from c43012f to 172cd00 Compare January 12, 2026 14:43
Copy link
Collaborator

@matanl-starkware matanl-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matanl-starkware reviewed 24 files and all commit messages, and made 6 comments.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @asmaastarkware and @dafnamatsry).


crates/apollo_consensus_orchestrator/src/validate_proposal.rs line 139 at r1 (raw file):

    is_block_info_valid(
        args.block_info_validation.clone(),
        args.block_info.clone(),

I don't like this clone

Code quote:

.clone()

crates/apollo_consensus_orchestrator/src/validate_proposal.rs line 149 at r1 (raw file):

        args.deps.batcher.clone(),
        args.deps.state_sync_client,
        args.block_info.clone(),

Same for this clone

Code quote:

.clone()

crates/apollo_protobuf/src/proto/p2p/proto/consensus/consensus.proto line 78 at r1 (raw file):

        BlockInfo block_info          = 1;
        ProposalFin fin               = 2;
        TransactionBatch transactions = 4;

Didn't change to 3 for a reason?

Code quote:

 4;

NODE_14_CONSENSUS_FAILURE_REPORT.md line 1 at r1 (raw file):

# Node 14 Consensus Failure - Root Cause Analysis

What is this file?

Code quote:

# Node 14 Consensus Failure - Root Cause Analysis

crates/apollo_consensus/src/single_height_consensus_test.rs line 37 at r1 (raw file):

const ROUND_1: Round = 1;

fn get_block_info_for_height(height: BlockNumber, round: Round) -> ConsensusBlockInfo {

Why don't we use block_info from the other module?

Code quote:

get_block_info_for_height

crates/apollo_consensus/src/single_height_consensus_test.rs line 131 at r1 (raw file):

    if repeat_proposal {
        // Duplicate block info should be ignored.
        let ret = shc.handle_proposal(&leader_fn, block_info.clone());

Why is cloning necessary now?

Code quote:

.clone()

@asmaastarkware asmaastarkware changed the base branch from asmaa/move_executed_transaction_count_into_proposalfin to graphite-base/11577 January 13, 2026 05:57
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from 172cd00 to dd8e485 Compare January 13, 2026 05:58
@asmaastarkware asmaastarkware changed the base branch from graphite-base/11577 to main-v0.14.1-committer January 13, 2026 05:58
@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from dd8e485 to 77283e9 Compare January 13, 2026 07:12
Copy link
Contributor Author

@asmaastarkware asmaastarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asmaastarkware made 3 comments.
Reviewable status: 18 of 24 files reviewed, 5 unresolved discussions (waiting on @dafnamatsry and @matanl-starkware).


crates/apollo_consensus/src/single_height_consensus_test.rs line 37 at r1 (raw file):

Previously, matanl-starkware (Matan Lior) wrote…

Why don't we use block_info from the other module?

Done.


crates/apollo_consensus/src/single_height_consensus_test.rs line 131 at r1 (raw file):

Previously, matanl-starkware (Matan Lior) wrote…

Why is cloning necessary now?

ConsensusBlockInfo does not derive Copy, are u ok with deriving it?


crates/apollo_protobuf/src/proto/p2p/proto/consensus/consensus.proto line 78 at r1 (raw file):

Previously, matanl-starkware (Matan Lior) wrote…

Didn't change to 3 for a reason?

no, done

@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from 77283e9 to 8feaa19 Compare January 13, 2026 09:21
Copy link
Collaborator

@matanl-starkware matanl-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matanl-starkware reviewed 12 files and all commit messages, made 1 comment, and resolved 3 discussions.
Reviewable status: 23 of 24 files reviewed, 2 unresolved discussions (waiting on @asmaastarkware and @dafnamatsry).


crates/apollo_consensus/src/single_height_consensus_test.rs line 131 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

ConsensusBlockInfo does not derive Copy, are u ok with deriving it?

No
I would like to avoid copying altogether.
Can't we pass a ref?

Copy link
Contributor Author

@asmaastarkware asmaastarkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asmaastarkware made 1 comment.
Reviewable status: 23 of 24 files reviewed, 2 unresolved discussions (waiting on @dafnamatsry and @matanl-starkware).


crates/apollo_consensus/src/single_height_consensus_test.rs line 131 at r1 (raw file):

Previously, matanl-starkware (Matan Lior) wrote…

No
I would like to avoid copying altogether.
Can't we pass a ref?

handle_proposal takes ownership of ConsensusBlockInfo because it moves it into SMRequest::StartValidateProposal, which requires ownership. If we used a reference, we'd need to clone it first, which is unnecessary since the caller already owns it and doesn't need it afterward.

Copy link
Collaborator

@matanl-starkware matanl-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matanl-starkware made 1 comment.
Reviewable status: 22 of 24 files reviewed, 2 unresolved discussions (waiting on @asmaastarkware and @dafnamatsry).


crates/apollo_consensus/src/single_height_consensus_test.rs line 131 at r1 (raw file):

Previously, asmaastarkware (asmaa-starkware) wrote…

handle_proposal takes ownership of ConsensusBlockInfo because it moves it into SMRequest::StartValidateProposal, which requires ownership. If we used a reference, we'd need to clone it first, which is unnecessary since the caller already owns it and doesn't need it afterward.

IIUC, when you derive Copy, you allow the compiler to silently shallow-copy the entire struct whenever required.
So either we transfer ownership and then the Copy is not required, or we have to copy the data to allow double data existence.

Copy link
Collaborator

@matanl-starkware matanl-starkware left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matanl-starkware reviewed 5 files and all commit messages, and resolved 2 discussions.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @dafnamatsry).

@asmaastarkware asmaastarkware force-pushed the 01-08-apollo_protobuf_merge_init_with_block_info branch from a671bd7 to 2d88cd6 Compare January 18, 2026 07:54
Copy link
Collaborator

@dafnamatsry dafnamatsry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dafnamatsry made 1 comment.
Reviewable status: 22 of 24 files reviewed, 1 unresolved discussion (waiting on @asmaastarkware and @matanl-starkware).


crates/apollo_protobuf/src/protobuf/protoc_output.rs line 493 at r7 (raw file):

    #[allow(clippy::derive_partial_eq_without_eq)]
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum Message {

I think keeping Init and removing the BlockInfo variant would be better. Semantically, Init better describes the purpose of this message—marking the beginning of a proposal stream. We can simply embed the required BlockInfo data inside the ProposalInit struct.

So my suggestion is:

pub mod proposal_part {
    pub enum Message {
        Init(super::ProposalInit),
        Fin(super::ProposalFin),
        Transactions(super::TransactionBatch),
    }
}

pub struct ProposalInit {
    pub height: u64,
    pub round: u32,
    pub valid_round: ::core::option::Option<u32>,
    pub proposer: ::core::option::Option<Address>,

    pub block_info: BlockInfo,
}

@matanl-starkware WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants